package com.wen.oss.controller;

import com.wen.commonutils.ResultEntity;
import com.wen.oss.service.OssService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @Author：Win
 * @Date: 2021/5/28 18:23
 * @Description:
 */
@RestController
@RequestMapping("/edu/oss/service/")
public class OssController {
    @Resource
    private OssService ossService;

    @PostMapping
    public ResultEntity uploadFileToOss(MultipartFile file) {
        String fileUrl = ossService.uploadAvatarFile(file);
        return ResultEntity.ok().data("fileUrl", fileUrl);
    }
}
